package com.xnyzc.lhy.statistics.eenum;

import com.xnyzc.lhy.common.exception.PangException;
import com.xnyzc.lhy.common.penum.EErrorCode;
import com.xnyzc.lhy.common.util.CheckUtil;

/**
 * 订单选择
 * @author  cuixiaojian
 */
public enum EOrderOption {

    /**
     * enum
     */
    ORDER_FLOW(1, "订单流水"),
    PASSENGER_INVOICE(2, "乘客发单量"),
    ANSWER_ORDER(3, "平台应答量"),
    ORDER_FULFILLMENT(4, "完成订单量"),
    ORDER_FULFILLMENT_PROPORTION(5, "平台完单率");

    private Integer key;
    private String value;

    EOrderOption(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public static String value(Integer key) {
        if (CheckUtil.objIsNotEmpty(key)) {
            for (EOrderOption examine : EOrderOption.values()) {
                if (key.equals(examine.getKey())) {
                    return examine.getValue();
                }
            }
        }
        throw PangException.create(EErrorCode.noData);
    }

    public Integer getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

}
